<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibQQt: R:/Develop/a0-develop/LibQQt/src/network/qqtprotocolmanager.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibQQt
   &#160;<span id="projectnumber">v3.1</span>
   </div>
   <div id="projectbrief">开源、跨平台Qt应用程序框架中间件</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_fc4c7f03e1a69a98c370fae55a743828.html">network</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">qqtprotocolmanager.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef QQTPROTOCOLMANAGER_H</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define QQTPROTOCOLMANAGER_H</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;QObject&gt;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;qqtmessage.h&quot;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;qqtprotocol.h&quot;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;qqtobjectmanager.h&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;qqtcore.h&quot;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;qqt-local.h&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="class_q_qt_protocol_manager.html">   37</a></span>&#160;<span class="keyword">class </span>QQTSHARED_EXPORT <a class="code" href="class_q_qt_protocol_manager.html">QQtProtocolManager</a> : <span class="keyword">public</span> QObject</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;{</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    Q_OBJECT</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_q_qt_protocol_manager.html">QQtProtocolManager</a> ( QObject* parent = 0 );</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="class_q_qt_protocol_manager.html">QQtProtocolManager</a>();</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="comment">//获取Protocol列表</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="comment">//这里列举的函数是给BusinessLevel用的，Protocol里面不要用</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="comment">//findProtocolInstanceByXXX(...);</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="comment">//findClientInfoByProtocolInstance(Protocol);</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="comment">//sendMessageToProtocolInstance(Protocol, Message);</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <span class="comment">//sendMessageToAllProtocolInstance(...);</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;signals:</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">void</span> notifyToBusinessLevel ( <span class="keyword">const</span> <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* protocol, <span class="keyword">const</span> <a class="code" href="class_q_qt_message.html">QQtMessage</a>* message );</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="class_q_qt_protocol_manager.html#a82e23b25b4991b6b04969bab7645cb1a">   79</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_q_qt_protocol_manager.html#a82e23b25b4991b6b04969bab7645cb1a">registerProtocol</a> ( <span class="keywordtype">int</span> count = 1024 ) {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; count; i++ ) {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* p0 = <span class="keyword">new</span> T ( <span class="keyword">this</span> );</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            m_protocol_list.push_back ( p0 );</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        }</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    }</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;signals:</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment">//内部每次协议句柄列表发生变动都会发射这个信号。</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="comment">//剩余的可用句柄数目</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordtype">void</span> remanentProtocolChanged ( <span class="keywordtype">int</span> num );</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordtype">void</span> remainingProtocolChanged ( <span class="keywordtype">int</span> num );</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* createProtocol ();</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordtype">void</span> deleteProtocol ( <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* stack );</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* findDetachedInstance();</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    QList&lt;QQtProtocol*&gt; m_protocol_list;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;};</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="preprocessor">#endif // QQTPROTOCOLMANAGER_H</span></div><div class="ttc" id="class_q_qt_protocol_manager_html"><div class="ttname"><a href="class_q_qt_protocol_manager.html">QQtProtocolManager</a></div><div class="ttdoc">The QQtProtocolManager class very good ideology and impliment 用于管理多个Protocol实例 用户实现的协议...</div><div class="ttdef"><b>Definition:</b> qqtprotocolmanager.h:37</div></div>
<div class="ttc" id="class_q_qt_message_html"><div class="ttname"><a href="class_q_qt_message.html">QQtMessage</a></div><div class="ttdoc">语法类 定义报文格式 </div><div class="ttdef"><b>Definition:</b> qqtmessage.h:10</div></div>
<div class="ttc" id="class_q_qt_protocol_html"><div class="ttname"><a href="class_q_qt_protocol.html">QQtProtocol</a></div><div class="ttdoc">The QQtProtocol class very good ideology and impliment. </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:17</div></div>
<div class="ttc" id="class_q_qt_protocol_manager_html_a82e23b25b4991b6b04969bab7645cb1a"><div class="ttname"><a href="class_q_qt_protocol_manager.html#a82e23b25b4991b6b04969bab7645cb1a">QQtProtocolManager::registerProtocol</a></div><div class="ttdeci">bool registerProtocol(int count=1024)</div><div class="ttdef"><b>Definition:</b> qqtprotocolmanager.h:79</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
